<?php include PATH_TPL."/admin/tpl.header.phtml"?>
<div class="main-container inner">
    <div class="main-content">
        <div class="container-fluid">
            <div class="row bt">
                <div class="col-lg-12 bg">
                    <ol class="breadcrumb">
                        <li class="active">
                            <i class="fa  fa-fw fa-reorder"></i>编辑职位
                        </li>
                    </ol>
                </div>
            </div>
            <div id="page-wrapper">
                <div class="container-fluid col-md-7 col-sx-12">
                    <form action="/admin_job/edit" method="post" enctype="multipart/form-data">
                        <div class="form-group ">
                            <label for="jobname">职位名称</label>
                            <input type="text" placeholder="输入职位名称" id="jobname" class="form-control" name="jobname" value="<?=$tRow['jobname']?>">
                        </div>
                        <div class="form-group ">
                            <label for="company">就职单位</label>
                            <input type="text" placeholder="输入单位名称" id="company" class="form-control" name="company" value="<?=$tRow['company']?>">
                        </div>
                        <div class="form-group ">
                            <label for="pay_small">最低薪资(单位:k)</label>
                            <input type="text" placeholder="输入最低薪资" id="pay_small" class="form-controll" name="pay_small" value="<?=$tRow['pay_small']?>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <label for="pay_big">最高薪资(单位:k)</label>
                            <input type="text" placeholder="输入最高薪资" id="pay_big" class="form-controll" name="pay_big" value="<?=$tRow['pay_big']?>">
                        </div>
                        <div class="form-group">
                            <label for="experience_start">最低工作经验(单位:年)</label>
                            <input type="text" placeholder="输入最低工作经验" id="experience_start" class="form-controll" name="experience_start" value="<?=$tRow['experience_start']?>" style="width:120px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <label for="experience_end">最高工作经验(单位:年)</label>
                            <input type="text" placeholder="输入最高工作经验" id="experience_end" class="form-controll" name="experience_end" value="<?=$tRow['experience_end']?>" style="width:118px;">
                        </div>
                        <div class="form-group ">
                            <label for="qualifications">学历</label>
                            <input type="text" placeholder="输入学历" id="qualifications" class="form-control" name="qualifications" value="<?=$tRow['qualifications']?>">
                        </div>
                        <div class="form-group ">
                            <label for="recruitment">招聘人数</label>
                            <input type="text" placeholder="输入招聘人数" id="recruitment" class="form-control" name="recruitment" value="<?=$tRow['recruitment']?>">
                        </div>
                        <div class="form-group ">
                            <label for="email">投递邮箱</label>
                            <input type="text" placeholder="输入投递邮箱" id="email" class="form-control" name="email" value="<?=$tRow['email']?>">
                        </div>
                        <div class="form-group ">
                            <label for="address">上班地址</label>
                            <input type="text" placeholder="输入上班地址" id="address" class="form-control" name="address" value="<?=$tRow['address']?>">
                        </div>
                        <div class="form-group ">
                            <label for="place">单位定位地址</label>
                            <input type="text" placeholder="输入单位定位地址" id="place" class="form-control" name="place" value="<?=$tRow['place']?>">
                        </div>
                        <div class="form-group">
                            <label for="descriptions">岗位职责</label>
                            <textarea id="responsibilities" style="height: 100px" class="form-control" name="responsibilities" placeholder="输入岗位职责（选填）"><?=$tRow['responsibilities']?></textarea>
                        </div>
                        <div class="form-group">
                            <label for="eligibility">任职资格</label>
                            <textarea id="eligibility" style="height: 100px" class="form-control" name="eligibility" placeholder="输入任职资格（选填）"><?=$tRow['eligibility']?></textarea>
                        </div>
                        <div class="form-group">
                            <label>公司编号</label>
                            <select name="companyno">
                                <option>--请选择--</option>
                                <?foreach($tCDatas as $tCRow){?>
                                <option <?if($tRow['companyid'] == $tCRow['id']){echo 'selected';}?>><?=$tCRow['id']?></option>
                                <?}?>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="status">发布状态</label></br>
                            <span>发布</span><input type="radio" name="status" value="0" <?if(empty($tRow['status'])){echo 'checked';}?>>&nbsp;&nbsp;
<span>未发布</span><input type="radio" name="status" value="1" <?if($tRow['status'] == 1){echo 'checked';}?>>
                        </div>
                        <input type="hidden" name="id" value="<?=$tId?>">
                        <button class="btn btn-primary demo_2" type="button" id="submit">修改</button>
                    </form>
                </div>
                <div class="container-fluid col-md-5">
                    <div class="images text-center" id="img_view">
                    </div>
                </div>
            </div>
        </div>
        <div class="subviews">
            <div class="subviews-container"></div>
        </div>
    </div>
    <!-- end: PAGE -->
</div>
<!-- end: MAIN CONTAINER -->
<script type="text/javascript" src="/plugins/jquery-ui-1.11.4/jquery-ui.min.js"></script>

<script type="text/javascript" src="/plugins/datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="/plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">

</script>

<script>
$(function(){
    var options={
        beforeSubmit : showRequest,    // 提交前的回调函数
        success : showResponse,    // 提交后的回调函数
        dataType : "json",    // html（默认）、xml、script、json接受服务器端返回的类型
        timeout : 3000    // 限制请求的时间，当请求大于3秒后，跳出请求
    }
    function showRequest(formData, jqForm, options){
        return true;
    }
    function showResponse(responseText,statusText){
            cg_alert_edit(responseText,'/admin_job','/admin_job/edit?id=<?=$tId?>');
    }
    $('#submit').click(function() {
        $('form').ajaxSubmit(options);
        return false;

    });
});

$("#name").autocomplete({
       source:"/admin_live/lecturer",
       select:function(event,ui){
            $(this).value = ui.item.name;
            $("#lecturer_id").val( ui.item.id );
            // 必须阻止默认行为，因为autocomplete默认会把ui.item.value设为输入框的value值
            event.preventDefault();     
        },
        focus:function(event,ui){
            $(this).val(ui.item.name);
            return false;
        },
}).data("ui-autocomplete")._renderItem = function (ul, item) {//.autocomplete('instance')._renderItem...
        return $("<li></li>")
            .data("item.autocomplete", item)
            .append("<a>" + item.name +"</a>")
            .appendTo(ul);
};

var result = document.getElementById("img_view");
var input = document.getElementById("file_input");

if(typeof FileReader==='undefined'){
   result.innerHTML = "抱歉，你的浏览器不支持 FileReader";
   input.setAttribute('disabled','disabled');
}else{
   input.addEventListener('change',readFile,false);
}
</script>
<?php include PATH_TPL."/admin/tpl.footer.phtml"?>
